<?php

namespace app\common;

class CommonResponse
{

    public function __construct($code, $msg, $data=null)
    {
        $this->code=$code;
        $this->msg=$msg;
        $this->data=$data;
    }

    public $code;
    public $msg;
    public $data;

    public static function success($msg,$data=null){
        return new CommonResponse(1,$msg,$data);
    }

    public static function error($msg){
        return new CommonResponse(0,$msg);
    }

}